<!--
 * @description: 查看对话
 * @fileName: PreviewDialogue
 * @author: 17076
 * @date: 2025/3/12-上午11:13
 * @version: V1.0.0
-->

<template>
  <cs-dialog
    :dialog="dialogOption"
    @onSubmit="save"
  >
    <div slot="content">
      <vxe-grid ref="xTable" v-bind="gridOptions" />
    </div>
  </cs-dialog>
</template>

<script>
import mixin from '@/views/mixin'
import { selectDialogue } from '@/api/lens'
export default {
  name: 'PreviewDialogue',
  mixins: [mixin],
  data() {
    return {
      dialogOption: {
        top: '5%',
        width: '55%',
        appendToBody: true,
        title: {
          title: '查看对话'
        },
        show: false
      },
      gridOptions: {
        ...mixin.data().gridOptions,
        columns: [
          // { title: '镜头', field: 'lens' },
          { title: '角色', field: 'roleName', width: '100px' },
          { title: '叙事方式', field: 'narrativeType', width: '100px' },
          { title: '对话内容', field: 'dialogueInfo' }
        ],
        data: []
      }
    }
  },
  methods: {
    show(data) {
      this.dialogOption.show = true
      this.fetchData(data)
    },
    // 获取对话内容
    fetchData(data) {
      selectDialogue({ lensId: data['lensId'] }).then(res => {
        this.gridOptions.data = res.data
      })
    },
    save(callback) {
      callback(true)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
